import { sendRequest } from '@/http';

const baseUrl = '/admin/elder';

/* 长者档案列表 */
export const queryElderList = (params: any) =>
  sendRequest({
    url: `${baseUrl}/queryElderList`,
    method: 'get',
    params,
  });

/* 长者档案列表 */
export const pageQueryElderByBranch = (params: any) =>
  sendRequest({
    url: `${baseUrl}/pageQueryElderByBranch`,
    method: 'get',
    params,
  });

/* 创建长者档案 */
export const createElder = (data: any) =>
  sendRequest({
    url: `${baseUrl}/createElder`,
    method: 'post',
    data,
    successText: '新建成功',
  });

/* 修改长者档案 */
export const editElder = (data: any) =>
  sendRequest({
    url: `${baseUrl}/editElderInfo`,
    method: 'post',
    data,
  });

/* 修改长者药品柜信息(新) */
export const editServiceInfo = (data: any) =>
  sendRequest({
    url: `${baseUrl}/editServiceInfo`,
    method: 'post',
    data,
  });

/* 修改长者床位信息(新) */
export const editAdmitInfo = (data: any) =>
  sendRequest({
    url: `${baseUrl}/editAdmitInfo`,
    method: 'post',
    data,
  });
/* 长者档案详情 */
export const queryElderDetail = (elderId: string) =>
  sendRequest({
    url: `${baseUrl}/queryElderDetail`,
    method: 'get',
    params: { elderId },
  });

/* 删除长者 */
export const deleteElder = (elderId: string) =>
  sendRequest({
    url: `${baseUrl}/deleteElder`,
    method: 'post',
    data: { elderId },
    successText: '删除成功',
  });
